package com.cc.demo.entity;

import lombok.*;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.io.Serializable;
import java.util.Date;

@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
@NoArgsConstructor
@AllArgsConstructor
@Builder(toBuilder = true)
@Entity
@Table(name = "TRANSACTION_EVENT_MESSAGE")
public class TransactionEventMessage extends VersionedEntityWithID implements Serializable {
    private static final long serialVersionUID = -6772524794843300533L;

    /* 记录message的内容 */
    @Column(name = "MESSAGE_BODY", length = 500)
    private String messageBody;

    /* 标记message对应的QUEUE */
    @Column(name = "CHANNEL", length = 50)
    private String channel;

    /* 标记message对应的真实的queue */
    @Column(name = "DESTINATION", length = 100)
    private String destination;

    /* 记录message的状态，1. 待发送 2. 确认发送 3. 完成(消费完成) 4. 失败*/
    /**
     * SENT; COMPLETED;
     */
    @Column(name = "STATUS", length = 20)
    private String status;

    /* 记录message处理的结果 */
    /**
     * SUCCESS; INFO; WARN; ERROR
     */
    @Column(name = "MESSAGE_RESULT", length = 20)
    private String messageResult;

    /* 记录message被消费处理完成的时间 */
    @Column(name = "EXECUTED_TIME")
    private Date executedTime;

    @Column(name = "RECEIVED_TIME")
    private Date receivedTime;

    /* 记录message被消费处理完成的时间间隔 */
    @Column(name = "DURATION", length = 11)
    private Long duration;

    /* 记录message的一些备注或者异常信息 */
    @Column(name = "MESSAGE_NOTE", length = 500)
    private String messageNote;

    /* message的唯一Id */
    @Column(name = "BUSINESS_KEY", length = 100)
    private String businessKey;

    /*来自哪个Application*/
    @Column(name = "OWNER", length = 50)
    private String owner;

    /*对应 Event的实体类 */
    @Column(name = "DOMAIN", length = 50)
    private String domain;

}
